# Maintainer: Brett Cornwall <ainola@archlinux.org>
# Contributor: Artem Senichev <artemsen@gmail.com>

pkgname=swayimg
pkgver=1.12
pkgrel=2
pkgdesc='A lightweight image viewer for Wayland display servers'
arch=('loong64' 'x86_64')
license=('MIT')
makedepends=(
    'bash-completion'  # Meson requirement
    'meson'
    'ninja'
    'wayland-protocols'
)
depends=(
    'cairo'
    'hicolor-icon-theme'
    'libexif.so'
    'libfontconfig.so'
    'libfreetype.so'
    'libgif.so'
    'libgobject-2.0.so'
    'libheif'
    'libjpeg.so'
    'libjson-c.so'
    'libjxl.so'
    'libpng'
    'librsvg-2.so'
    'libtiff.so'
    'libwayland-client.so'
    'libwebp.so'
    'libwebpdemux.so'
    'libxkbcommon'
    'openexr'
)
url='https://github.com/artemsen/swayimg'
source=("$pkgname-$pkgver.tar.gz::https://github.com/artemsen/swayimg/archive/v$pkgver.tar.gz")
sha256sums=('4617322a1ec17985770dc351eea69b42b1464f2d838eb5015314634b2a30f126')

build() {
    arch-meson build ${pkgname}-${pkgver} \
        -D bash=enabled \
        -D desktop=true \
        -D exif=enabled \
        -D gif=enabled \
        -D heif=enabled \
        -D jpeg=enabled \
        -D jxl=enabled \
        -D man=true \
        -D png=enabled \
        -D svg=enabled \
        -D tiff=enabled \
        -D version="$pkgver" \
        -D webp=enabled \
        -D zsh=enabled
    ninja -C build
}

package(){
    DESTDIR="$pkgdir" ninja -C build install

    cd "$pkgname-$pkgver"
    install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
    install -Dm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
    install -Dm644 extra/swayimgrc -t "$pkgdir/usr/share/doc/$pkgname/"
}
